(function (global) {
    let merchant = {};
    merchant.checkout = function (id) {
        $(id).bootstrapValidator({
            fields: {
                name: {
                    validators: {
                        notEmpty: {
                            message: '菜名不可为空'
                        }
                    }
                },
                price: {
                    validators: {
                        notEmpty: {
                            message: '价格不可为空'
                        },
                        regexp: {
                            regexp: /^[0-9]*$/,
                            message: '输入格式有误,只能是数字'
                        }
                    }
                }
            }
        });
    };
    global.dishesCheckOut = merchant;
})(window);